function varerr(time,y,R,~,y0,Y)

load('orthbase');

exactvar=zeros(1,100);
intR    =zeros(1,100);
time(1)=10^-15;

for ii=1:100
%     exactvar(ii)=(y0(1)+quadl(@(s) R(s)-1/2*sig(s).*sig(s),0,time(ii)))^2 ...
%         +quadl(@(s) sig(s).*sig(s),0,time(ii));
%      exactvar(ii)=quadl(@(s) sig(s).*sig(s),0,time(ii));
      intR(ii) = quadl(@(s) R(s),0,time(ii));
end
exactvar=y0(1)^2+1/2*time.^2+2*y0(1)*intR-1/2*y0(1)*time.^2+intR.^2-1/2*time.^2.*intR...
    +7/4*time.^4-(y0(1)+intR-1/4*time.^2).^2;
hold on
plot(time,exactvar);
tmp=zeros(size(y(:,1)));
for ii=2:size(Y,2)
    tmp=tmp+Y(:,ii).*Y(:,ii);
end
plot(time,tmp,'r-');
title('Variance')
legend('exact var','wce var');
